import { FC } from 'react'
import { Typography } from 'antd'
import PropComponent from './PropComponent'
const { Title } = Typography

export type propsType = {
  text?: string
  level?: 1 | 2 | 3 | 4 | 5
  isCenter?: boolean
  disabled?: boolean
}

const questionTitle: FC<propsType> = props => {
  const { text = '标题', level = 1, isCenter = false } = props
  const genFontSize = (level: number) => {
    switch (level) {
      case 1:
        return '24px'
      case 2:
        return '20px'
      case 3:
        return '16px'
      default:
        return '16px'
    }
  }
  return (
    <Title
      level={level}
      style={{
        textAlign: isCenter ? 'center' : 'start',
        marginBottom: '0',
        fontSize: genFontSize(level),
      }}>
      {text}
    </Title>
  )
}
export const questionTitleConfig = {
  title: '输入框',
  type: 'questionTitle',
  PropComponent,
  Component: questionTitle,
}

export default questionTitle
